<!DOCTYPE html>
<html>
<head><title>产权人信息提前登记</title>
    <#include "../common/common.ftl"/>
    <link rel="stylesheet" href="/style/contractForm.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <form class="layui-form" id="dataForm">
        <input type="hidden" name="contractId" value="${(contract.id)!}"/>
        <div class="layui-card">
            <div class="layui-card-header">一、被征收人基本信息</div>
            <div class="layui-card-body">
                <div class="layui-form-item">
                    <div class="layui-col-xs4">
                        征收项目：${(contract.zsProject.projectName)!}
                    </div>
                    <div class="layui-col-xs4">
                        协议编号：${(contract.contractCode)!}
                    </div>
                    <div class="layui-col-xs4">
                        选房号：${(contract.chooseHouseNum)!}
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-col-xs4">
                        被征收人：${(contract.name)!}
                    </div>
                    <div class="layui-col-xs4">
                        身份证号：${(contract.idCard)!}
                    </div>
                    <div class="layui-col-xs4">
                        选择产权调换面积：【<span class="jmdf-color-red">${(contract.limitHouseAreaTotal)!}</span>】㎡
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-col-xs4">
                        住改商间数：${(contract.zgsHouseAzNum)!}<span class="jmdf-color-red">间</span>
                    </div>
                    <div class="layui-col-xs4">
                        商业店面间数：${(contract.syDmAzNum)!}<span class="jmdf-color-red">间</span>
                    </div>
                    <div class="layui-col-xs4">
                        安置方式：<span class="jmdf-color-red">${(contract.azType)!}</span>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-col-xs12">
                        所在路段：${(contract.zqSzLd)!}
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-card">
            <div class="layui-card-header">二、预定户型</div>
            <div class="layui-card-body">
                <div class="layui-form-item">
                    <#if contract.carLotYxYdNum?? && contract.carLotYxYdNum gt 0>
                        <div class="layui-col-xs2">
                            预定车位：${(contract.carLotYxYdNum)!}<span class="jmdf-color-red">个</span>
                        </div>
                    </#if>
                    <#if contract.carLotYxZhNum?? && contract.carLotYxZhNum gt 0>
                        <div class="layui-col-xs2">
                            置换车位：${(contract.carLotYxZhNum)!}<span class="jmdf-color-red">个</span>
                        </div>
                    </#if>
                    <#if contract.house60YxNum?? && contract.house60YxNum gt 0>
                        <div class="layui-col-xs2">
                            60型：${(contract.house60YxNum)!}<span class="jmdf-color-red">套</span>
                        </div>
                    </#if>
                    <#if contract.house80YxNum?? && contract.house80YxNum gt 0>
                        <div class="layui-col-xs2">
                            80型：${(contract.house80YxNum)!}<span class="jmdf-color-red">套</span>
                        </div>
                    </#if>
                    <#if contract.house100YxNum?? && contract.house100YxNum gt 0>
                        <div class="layui-col-xs2">
                            100型：${(contract.house100YxNum)!}<span class="jmdf-color-red">套</span>
                        </div>
                    </#if>
                    <#if contract.house120YxNum?? && contract.house120YxNum gt 0>
                        <div class="layui-col-xs2">
                            120型：${(contract.house120YxNum)!}<span class="jmdf-color-red">套</span>
                        </div>
                    </#if>
                </div>

                <div class="layui-form-item">
                    <#if contract.house140YxNum?? && contract.house140YxNum gt 0>
                        <div class="layui-col-xs2">
                            140型：${(contract.house140YxNum)!}<span class="jmdf-color-red">套</span>
                        </div>
                    </#if>
                    <#if contract.house160YxNum?? && contract.house160YxNum gt 0>
                        <div class="layui-col-xs2">
                            160型：${(contract.house160YxNum)!}<span class="jmdf-color-red">套</span>
                        </div>
                    </#if>
                    <#if contract.house180YxNum?? && contract.house180YxNum gt 0>
                        <div class="layui-col-xs2">
                            180型：${(contract.house180YxNum)!}<span class="jmdf-color-red">套</span>
                        </div>
                    </#if>
                    <#if contract.houseFsOneYxNum?? && contract.houseFsOneYxNum gt 0>
                        <div class="layui-col-xs2">
                            复式1型：${(contract.houseFsOneYxNum)!}<span class="jmdf-color-red">套</span>
                        </div>
                    </#if>
                    <#if contract.houseFsTwoYxNum?? && contract.houseFsTwoYxNum gt 0>
                        <div class="layui-col-xs2">
                            复式2型：${(contract.houseFsTwoYxNum)!}<span class="jmdf-color-red">套</span>
                        </div>
                    </#if>
                </div>
            </div>
        </div>
        <div class="layui-card">
            <div class="layui-card-header">三、产权人信息【<span class="jmdf-color-red">所有数据全部填写系统才会保存，否则自动删除!</span>】</div>
            <div class="layui-card-body">
                <table class="layui-table" id="overAreaTable">
                    <tr class="layui-bg-gray">
                        <th style="text-align: center;width: 15%">姓名<span class="jmdf-color-red"></span></th>
                        <th style="text-align: center;width: 30%">身份证号<span class="jmdf-color-red"></span></th>
                        <th style="text-align: center;width: 20%">联系方式<span class="jmdf-color-red"></span></th>
                        <th style="text-align: center;width: 10%">与被征人<br/>关系<br/><span class="jmdf-color-red"></span></th>
                        <th style="text-align: center;width: 10%">获得方式<br/><span class="jmdf-color-red"></span></th>
                        <th style="text-align: center;width: 15%">备注<br/><span class="jmdf-color-red"></span></th>
                    </tr>
                    <#if (buyHousePeopleList?size == 0)>
                        <tr>
                            <td style="text-align: center;">
                                <input type="text" name="name" placeholder="不填写将删除"  class="layui-input" value="" />
                            </td>
                            <td style="text-align: center;">
                                <input type="text" name="idCard" placeholder="不填写将删除"  class="layui-input" value="" />
                            </td>
                            <td style="text-align: center;">
                                <input type="text" name="tel" placeholder="不填写将删除"  class="layui-input" value="" />
                            </td>
                            <td style="text-align: center;">
                                <input type="text" name="relation" placeholder="不填写将删除"  class="layui-input" value="" />
                            </td>
                            <td style="text-align: center;">
                                <input type="text" name="type" placeholder="不填写将删除"  class="layui-input" value="" />
                            </td>
                            <td style="text-align: center;">
                                <input type="text" name="memo" class="layui-input" value="" />
                            </td>
                        </tr>
                    <#else>
                        <#list buyHousePeopleList as buyHousePerson>
                            <tr>
                                <td style="text-align: center;">
                                    <input type="text" name="name" class="layui-input" value="${(buyHousePerson.name)!}"/>
                                </td>
                                <td style="text-align: center;">
                                    <input type="text" name="idCard" class="layui-input" value="${(buyHousePerson.idCard)!}" />
                                </td>
                                <td style="text-align: center;">
                                    <input type="text" name="tel" class="layui-input" value="${(buyHousePerson.tel)!}"/>
                                </td>
                                <td style="text-align: center;">
                                    <input type="text" name="relation" class="layui-input" value="${(buyHousePerson.relation)!}" />
                                </td>
                                <td style="text-align: center;">
                                    <input type="text" name="type" class="layui-input" value="${(buyHousePerson.type)!}" />
                                </td>
                                <td style="text-align: center;">
                                    <input type="text" name="memo" class="layui-input" value="${(buyHousePerson.memo)!}" />
                                </td>
                            </tr>
                        </#list>
                    </#if>
                </table>
                <div align="center"><input type="button" id="addRow" class="layui-btn" value="添加新行"/></div>
            </div>
        </div>
        <button style="display: none;" class="layui-btn" id="submitBtn" name="submitBtn" lay-submit="" lay-filter="submit">立即提交</button>
    </form>
</div>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>
    layui.config({
        base: '/modules/' //静态资源所在路径
    }).use(['form', "verify", "dataDict"], function () {
        var form = layui.form, $ = layui.jquery, verify = layui.verify,parentIndex = parent.layer.getFrameIndex(window.name);

        //增加新行
        $("#addRow").click(function () {
            var rowIndex = $("#overAreaTable tr").length - 1;
            $("#overAreaTable tr:last").clone().insertAfter($("#overAreaTable tr:eq(" + rowIndex + ")"));
            $("#overAreaTable tr:last input").each(function () {
                $(this).val("");
            });
            form.render();
        });

        //监听提交
        form.on('submit(submit)', function (data) {
            $.ajax({
                url: 'personDataFormSave',
                type: 'post',
                data: $("#dataForm").serialize(),
                success: function (data) {
                    if (data.code == "0001") {
                        layer.alert(data.message);
                        parent.loadData();
                        parent.layer.close(parentIndex);
                    } else {
                        layer.msg(data.message, {anim: 6, icon: 2, time: 3000});
                    }
                }
            });
            return false;
        });

    });
</script>
</body>
</html>